<?php

class Silk_Zgb_Block_Renderer_Spend extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
	public function render(Varien_Object $row)
	{
		$id =  $row->getData($this->getColumn()->getIndex());
		$coreHelper = Mage::helper('core');
		$orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',array('eq'=>$id));
		$total = 0;
		foreach($orders as $order)
		{
			if($order->getStatus()!="canceled")
			{
				$total += $order->getGrandTotal();
			}
		}
		return $coreHelper->formatPrice($total, false);
	}
}